package md.lanjing.com.module_mine.contact;

import android.content.Context;

import com.lxh.baselibray.constant.Constant;
import com.lxh.baselibray.mvp.BasePresent;
import com.lxh.baselibray.mvp.IBaseView;
import com.lxh.baselibray.net.NetCallBack;
import com.lxh.baselibray.net.ServiceGenerator;
import com.lxh.baselibray.util.SPUtils;
import com.lxh.baselibray.util.ToastUtils;

import md.lanjing.com.module_mine.R;
import md.lanjing.com.module_mine.api.MineApiService;
import md.lanjing.com.module_mine.bean.DealCenterNacVacancyResponce;
import retrofit2.Call;
import retrofit2.Response;

public class MyWalletContact {
    public static class MyWalletPresent extends BasePresent<IMyWalletView> {
        public void getVacancy(final Context context){
            MineApiService service= ServiceGenerator.createService(MineApiService.class);
            int userId= SPUtils.getInt(Constant.USER_ID,-1,context);
            service.getNacVaCancy(userId).enqueue(new NetCallBack<DealCenterNacVacancyResponce>() {
                @Override
                public void onSuccess(Call<DealCenterNacVacancyResponce> call, Response<DealCenterNacVacancyResponce> response) {
                    if (getView()!=null){
                        getView().getVacancyData(response);
                    }

                }

                @Override
                public void onFailed() {
                    ToastUtils.showLongToast(context,context.getString(R.string.request_failed));
                }
            });

        }


    }
    public interface IMyWalletView extends IBaseView {
        void getVacancyData(Response<DealCenterNacVacancyResponce> response);
    }
}
